﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace StudentManagementSystem
{
    public partial class Form4 : Form
    {

        private Database db = new Database();

        public Form4()
        {
            InitializeComponent();
            LoadLogs();
        }

        // 加载日志信息到 DataGridView
        private void LoadLogs()
        {
            using (var conn = db.GetConnection())
            {
                string query = "SELECT * FROM Log ORDER BY Timestamp DESC";
                MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
                DataTable logTable = new DataTable();
                adapter.Fill(logTable);
                dataGridView1.DataSource = logTable;
            }
        }
    }
}
